use diesel::prelude::*;
use diesel::pg::PgConnection;
use dotenv::dotenv;
use std::env;

pub fn psql() -> PgConnection{
    dotenv().ok();

    let db_url = env::var("DATABASE_URL")
        .expect("DATABASE must be set");
    PgConnection::establish(&db_url)
        .expect(
            &format!("Error connection to {}", db_url)
        )
}